package com.landlords.constants;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.landlords.model.Poker;

/**
 * 扑克牌的常量
 * 
 * @author samoin
 * @since 2011-5-31
 */
public class PokerConstatns {

	/**
	 * 一副扑克牌的数量
	 */
	public static final int POKER_TOTAL_COUNT = 54; // 一副扑克54张牌

	/**
	 * 扑克牌的花色
	 */
	public static final int POKER_COLOR_SPADES = 1;// 黑桃
	public static final int POKER_COLOR_HEARTS = 2;// 红桃
	public static final int POKER_COLOR_PLUMFLOWER = 3;// 梅花
	public static final int POKER_COLOR_BOX = 4;// 方块

	public static final int POKER_COLOR_KING = 5;// 王

	public static final String POKER_DESC_COLOR_SPADES = "spades";// 黑桃
	public static final String POKER_DESC_COLOR_HEARTS = "hearts";// 红桃
	public static final String POKER_DESC_COLOR_PLUMFLOWER = "plumflower";// 梅花
	public static final String POKER_DESC_COLOR_BOX = "box";// 方块

	public static final String POKER_DESC_COLOR_KING = "king";// 王

	/**
	 * 扑克牌，从1-13，大、小王
	 */
	public static final int POKER_NUM_ONE = 1;// 1
	public static final int POKER_NUM_TWO = 2;// 2
	public static final int POKER_NUM_THREE = 3;// 3
	public static final int POKER_NUM_FOUR = 4;// 4
	public static final int POKER_NUM_FIVE = 5;// 5
	public static final int POKER_NUM_SIX = 6;// 6
	public static final int POKER_NUM_SEVEN = 7;// 7
	public static final int POKER_NUM_EIGHT = 8;// 8
	public static final int POKER_NUM_NINE = 9;// 9
	public static final int POKER_NUM_TEN = 10;// 10
	public static final int POKER_NUM_ELEVEN = 11;// J
	public static final int POKER_NUM_TWELVE = 12;// Q
	public static final int POKER_NUM_THIRTEEN = 13;// K

	public static final int POKER_NUM_YONG_KING = 14;// YONG KING
	public static final int POKER_NUM_OLD_KING = 15;// OLD KING

	public static final String POKER_DESC_NUM_ONE = "A";// 1
	public static final String POKER_DESC_NUM_TWO = "2";// 2
	public static final String POKER_DESC_NUM_THREE = "3";// 3
	public static final String POKER_DESC_NUM_FOUR = "4";// 4
	public static final String POKER_DESC_NUM_FIVE = "5";// 5
	public static final String POKER_DESC_NUM_SIX = "6";// 6
	public static final String POKER_DESC_NUM_SEVEN = "7";// 7
	public static final String POKER_DESC_NUM_EIGHT = "8";// 8
	public static final String POKER_DESC_NUM_NINE = "9";// 9
	public static final String POKER_DESC_NUM_TEN = "10";// 10
	public static final String POKER_DESC_NUM_ELEVEN = "J";// J
	public static final String POKER_DESC_NUM_TWELVE = "Q";// Q
	public static final String POKER_DESC_NUM_THIRTEEN = "K";// K

	public static final String POKER_DESC_YONG_KING = "大王";// YONG KING
	public static final String POKER_DESC_OLD_KING = "小王";// OLD KING

	public static final Map<Integer, String> POKER_COLOR_MAP = new HashMap<Integer, String>();// 花色的map
	public static final Map<Integer, String> POKER_ALLCOLOR_MAP = new HashMap<Integer, String>();// 所有花色的map
	public static final Map<Integer, String> POKER_NUMBER_MAP = new HashMap<Integer, String>();// 所有牌的map
	public static final int[] POKER_SHUN_ARRAY = { POKER_NUM_ONE,
			POKER_NUM_TWO, POKER_NUM_THREE, POKER_NUM_FOUR, POKER_NUM_FIVE,
			POKER_NUM_SIX, POKER_NUM_SEVEN, POKER_NUM_EIGHT, POKER_NUM_NINE,
			POKER_NUM_TEN, POKER_NUM_ELEVEN, POKER_NUM_TWELVE,
			POKER_NUM_THIRTEEN, POKER_NUM_ONE };// 顺子的数组(1-K,1)
	public static final int[] POKER_POWER_ARRAY = { POKER_NUM_OLD_KING,
			POKER_NUM_YONG_KING, POKER_NUM_TWO, POKER_NUM_ONE,
			POKER_NUM_THIRTEEN, POKER_NUM_TWELVE, POKER_NUM_ELEVEN,
			POKER_NUM_TEN, POKER_NUM_NINE, POKER_NUM_EIGHT, POKER_NUM_SEVEN,
			POKER_NUM_SIX, POKER_NUM_FIVE, POKER_NUM_FOUR, POKER_NUM_THREE };// 牌的大小顺序
	public static final List<Poker> A_DECK_OF_POKERS = new ArrayList<Poker>();// 一副扑克牌

	static {

		POKER_COLOR_MAP.put(POKER_COLOR_SPADES, POKER_DESC_COLOR_SPADES);
		POKER_COLOR_MAP.put(POKER_COLOR_HEARTS, POKER_DESC_COLOR_HEARTS);
		POKER_COLOR_MAP
				.put(POKER_COLOR_PLUMFLOWER, POKER_DESC_COLOR_PLUMFLOWER);
		POKER_COLOR_MAP.put(POKER_COLOR_BOX, POKER_DESC_COLOR_BOX);

		POKER_ALLCOLOR_MAP.put(POKER_COLOR_SPADES, POKER_DESC_COLOR_SPADES);
		POKER_ALLCOLOR_MAP.put(POKER_COLOR_HEARTS, POKER_DESC_COLOR_HEARTS);
		POKER_ALLCOLOR_MAP.put(POKER_COLOR_PLUMFLOWER,
				POKER_DESC_COLOR_PLUMFLOWER);
		POKER_ALLCOLOR_MAP.put(POKER_COLOR_BOX, POKER_DESC_COLOR_BOX);
		POKER_ALLCOLOR_MAP.put(POKER_COLOR_KING, POKER_DESC_COLOR_KING);

		POKER_NUMBER_MAP.put(POKER_NUM_ONE, POKER_DESC_NUM_ONE);
		POKER_NUMBER_MAP.put(POKER_NUM_TWO, POKER_DESC_NUM_TWO);
		POKER_NUMBER_MAP.put(POKER_NUM_THREE, POKER_DESC_NUM_THREE);
		POKER_NUMBER_MAP.put(POKER_NUM_FOUR, POKER_DESC_NUM_FOUR);
		POKER_NUMBER_MAP.put(POKER_NUM_FIVE, POKER_DESC_NUM_FIVE);
		POKER_NUMBER_MAP.put(POKER_NUM_SIX, POKER_DESC_NUM_SIX);
		POKER_NUMBER_MAP.put(POKER_NUM_SEVEN, POKER_DESC_NUM_SEVEN);
		POKER_NUMBER_MAP.put(POKER_NUM_EIGHT, POKER_DESC_NUM_EIGHT);
		POKER_NUMBER_MAP.put(POKER_NUM_NINE, POKER_DESC_NUM_NINE);
		POKER_NUMBER_MAP.put(POKER_NUM_TEN, POKER_DESC_NUM_TEN);
		POKER_NUMBER_MAP.put(POKER_NUM_ELEVEN, POKER_DESC_NUM_ELEVEN);
		POKER_NUMBER_MAP.put(POKER_NUM_TWELVE, POKER_DESC_NUM_TWELVE);
		POKER_NUMBER_MAP.put(POKER_NUM_THIRTEEN, POKER_DESC_NUM_THIRTEEN);
		POKER_NUMBER_MAP.put(POKER_NUM_YONG_KING, POKER_DESC_YONG_KING);
		POKER_NUMBER_MAP.put(POKER_NUM_OLD_KING, POKER_DESC_OLD_KING);

		/**
		 * 生成一副扑克
		 */
		A_DECK_OF_POKERS.add(new Poker(POKER_COLOR_KING, POKER_NUM_YONG_KING));
		A_DECK_OF_POKERS.add(new Poker(POKER_COLOR_KING, POKER_NUM_OLD_KING));
		Iterator<Integer> it = POKER_COLOR_MAP.keySet().iterator();
		while (it.hasNext()) {
			Integer key = it.next();
			for (int i = 0; i < POKER_SHUN_ARRAY.length - 1; i++) {
				A_DECK_OF_POKERS.add(new Poker(key, POKER_SHUN_ARRAY[i]));
			}
		}
		/**
		 * 生成一副扑克end
		 */
	}

}
